7<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!--
    	作者：845510257@qq.com
    	时间：2017-10-25
    	描述：title部分，公共js,公共css和jstl标签库
    -->
<%@include file="/source/page/parts/title.jsp"%>
<!-- 	下面引入本页面单独引入的资源 -->


<link rel="stylesheet" href="/GDZjiajiaowang/source/css/indexStyle.css"
	type="text/css" />
<link rel="stylesheet" href="/GDZjiajiaowang/source/css/teacherInfo.css"
	type="text/css" />
<link rel="stylesheet"
	href="/GDZjiajiaowang/source/css/studentOrder.css" type="text/css" />
<script type="text/javascript"
	src="/GDZjiajiaowang/source/js/teacherInfo.js">
</script>
</head>
<body>
	<!--
            	作者：GGVVR
            	时间：2017-10-25
            	描述：header部分（head_top、head_middle、head_botton）
            -->
	<%@include file="/source/page/parts/header.jsp"%>
	<section>
		<div class="main_line">

			<div class="main_line_one">
				<p>
					<span>GDZ家教网</span> <span>></span> <span>教员信息列表</span> <span>></span>
					<span>教员信息</span>
				</p>
			</div>
		</div>
		<div class="teacher_introduce_line_one">
			<div class="teacher_introduce_banner">
				<div class="teacher_introduce_banner_center">
					<div class="teacher_introduce_banner_center_line01">
						<div class="teacher_introduce_banner_center_line01_photo">
							<img src=${teacherInfos.src
								}
								id="teacher_introduce_banner_src" />
						</div>
						<div>
							<p>
								<span class="teacher_introduce_banner_name">${teacherInfos.teacherRealName}</span><span
									id="teacher_introduce_banner_postion">(老师)</span><span>编号:T000</span><span
									class="teacher_introduce_banner_num">${teacherInfos.teacherId}</span>
							</p>
							<p>教员简介：</p>
							<p class="teacher_introduce_banner_introduc">${teacherInfos.selfmark}</p>
							<p>
								教学经验:<b class="teacher_introduce_banner_experience">${teacherInfos.teachYear}</b><b></b>
							</p>
						</div>

					</div>
					<div class="teacher_introduce_banner_center_line02">
						<div class="teacher_introduce_banner_center_line02_center">
							<ul>
								<li>教师性别：<span id="teacher_introduce_banner_sex">${teacherInfos.teacherSex}</span></li>
								<li>教师类型：<span id="teacher_introduce_banner_teacherType">${teacherInfos.type}</span></li>
								<li>毕业学校：<span
									id="teacher_introduce_banner_teacherUniversity">${teacherInfos.teacherUniversity}</span></li>
								<li>获得证书：<span id="teacher_introduce_banner_certificate">${teacherInfos.certificate}</span></li>
							</ul>
						</div>
					</div>
					<div class="teacher_introduce_banner_center_line03">
						<div class="teacher_introduce_banner_center_right_1">
							<p>
								预约<span id="right_teacherName">${teacherInfos.teacherRealName}</span>老师
							</p>
							<form>
								<div class="order_person">
									<label>*联系人<br /> <input type="text" name="userName"
										value="" / id="orderUserName"><br /></label> <label>*联系方式<br>
										<input type="text" name="userPhone" value=""
										id="orderUserPhone" /><br /></label> <label>*年级<br /> <!-- 									<input type="text" name="userGrade" value="" /> -->
										<select id="gradeName_choose" onchange=change_gradeName(this)>
											<option value="8">一年级</option>
											<option value="9">二年级</option>
											<option value="10">三年级</option>
											<option value="11">四年级</option>
											<option value="12">五年级</option>
											<option value="13">六年级</option>
											<option value="14">初一</option>
											<option value="15">初二</option>
											<option value="16">初三</option>
											<option value="17">高一</option>
											<option value="18">高二</option>
											<option value="19">高三</option>
									</select> <br /></label> <label id="subject_list_to_choose">*科目
										<div class="chose_subject_div clearfix" id="chose_subject_div">
											<span class="chose_subject" subjectId="1">语文</span> <span
												class="chose_subject" subjectId="2">数学</span> <span
												class="chose_subject" subjectId="3">英语</span> <span
												class="chose_subject" subjectId="4">物理</span> <span
												class="chose_subject" subjectId="5">化学</span> <span
												class="chose_subject" subjectId="7">地理</span> <span
												class="chose_subject" subjectId="8">政治</span> <span
												class="chose_subject" subjectId="9">历史</span> <span
												subjectId="6" class="chose_subject">生物</span>

										</div>

									</label> <input type="button" name="" value="立即预约"
										id="order_person_submit" />

								</div>

							</form>

						</div>
					</div>
				</div>
			</div>
		</div>
		<div class="teacher_introduce_line_two">
			<div class="teacher_introduce_line_two_left">
				<div class="teacher_introduce_line_two_left_line01 clearfix">
					<ul class="clearfix">
						<li>详细信息</li>
						<li>成功记录</li>
						<li>教学理念</li>
						<li>教师风采</li>
					</ul>
				</div>
				<div class="teacher_info">
					<h1>详细信息</h1>
					<table border="" cellspacing="" cellpadding="">
						<tr>
							<td>教授年级：</td>
							<td id="gradeName">${teacherInfos.gradeName}</td>
						</tr>
						<tr>
							<td>教授科目：</td>
							<td id="subjectName">${teacherInfos.subjectName}</td>
						</tr>
						<tr>
							<td>授课区域：</td>
							<td id="addressName">${teacherInfos.addressName}</td>
						</tr>
						<tr>
							<td>具体区域：</td>
							<td id="addressDesc">${teacherInfos.addressDesc}</td>
						</tr>
						<tr>
							<td>薪资要求：</td>
							<td>按照GDZ薪资标准</td>
						</tr>
						<tr>
							<td>所获证书：</td>
							<td id="certificate">${teacherInfos.certificate}</td>
						</tr>
						<tr>
							<td>辅导方式：</td>
							<td id="workType">${teacherInfos.workType}</td>
						</tr>
						<tr>
							<td>其他要求：</td>
							<td id="other">${teacherInfos.other}</td>
						</tr>
					</table>
				</div>
				<div class="teacher_success_orders">
					<h1>成功记录</h1>
					<table border="" cellspacing="" cellpadding="" id="orders">
						<tr>
							<td>订单号</td>
							<td>年级科目</td>
							<td>状态</td>
							<td>接单日期</td>
						</tr>
						<tr>
							<td>1101</td>
							<td>高三英语</td>
							<td>成功</td>
							<td>2016-12-6</td>
						</tr>
					</table>
				</div>
				<div class="teacher_education_dream"></div>
				<div class="teacher_pictures"></div>
			</div>

		</div>
	</section>

	<!--
    	作者：845510257@qq.com
    	时间：2017-10-25
    	描述：footer部分，
    -->
	<%@include file="/source/page/parts/footer.jsp"%>

	<!--
    	作者：杨辉
    	时间：2017-10-25
    	描述：登录弹窗，
    -->
	<%@include file="/source/page/parts/loginMini.jsp"%>


	<!--
    	作者：吴金山
    	时间：2017-10-25
    	描述：登录js
    -->
	<%@include file="/source/page/parts/login.jsp"%>

	<!--
            	作者：GGVVR
            	时间：2017-10-25
            	描述：下单成功
            -->
	<%@include file="/source/page/parts/studentOrder.jsp"%>

<!-- QQ客服代码 -->
	<div style="position:fixed; bottom:100px; right:10px; z-index:2;">
	<a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=845510257&site=qq&menu=yes"><img border="0" src="/GDZjiajiaowang/source/img/timg.jpg"  width=50px height=50px alt="点击这里给我发消息" title="点击这里给我发消息"/></a>
	</div>
<!-- 		<a target="_blank" -->
<!-- 			href="http://wpa.qq.com/msgrd?v=3&uin=&site=qq&menu=yes"><img -->
<!-- 			src="/GDZjiajiaowang/source/img/timg.jpg" alt="点击这里给我发消息" title="点击这里给我发消息"  width=50px height=50px></a> -->
<!-- 		<a target='_blank' href='tencent://message/?uin=845510257&amp;Site=在线客服&Menu=yes' title='在线即时交谈'><img src="images/qq_01.png"/></a> -->
	
<!-- 	<div style="position:fixed; top:230px; right:220px; z-index:2;"> -->
<!-- 		<a target='_blank' -->
<!-- 			href='http://wpa.qq.com/msgrd?V=1&Uin=2010077581&Site=在线咨询&Menu=yes' -->
<!-- 			title='在线即时交谈'><img src="/GDZjiajiaowang/source/img/timg.jpg" width=50px height=50px/></a> -->
<!-- 	</div> -->

<!-- <a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=&site=qq&menu=yes"><img border="0" src="http://wpa.qq.com/pa?p=2::52" alt="欢迎使用GDZ家教网" title="欢迎使用GDZ家教网"/></a> -->




</body>

<script type="text/javascript">
$(function(){
//进入页面后的订单ajax
			var teacherId_json = {"teacherId" : "${teacherInfos.teacherId}"};
			$.ajax({
						type : "post",
						data : teacherId_json,
						dataType : "json",
						url : "/GDZjiajiaowang/TeacherInfoOrderServlet",
						contentType : "application/x-www-form-urlencoded; charset =utf-8",
						success : function(orders) {
							if (null == orders || orders.length == 0) {
								return false;
							}
							var str = "";
							var status = "";
							for (var i = 0; i < orders.length; i++) {
								var order = orders[i];
								status = "成功";
								if (order.profit == 0) {
									status = "失败";
								}
								var orderId = "d" + order.orderId;
								str += "<tr><td>" + orderId + "</td><td>"
										+ order.gradeName + " "
										+ order.subjectName + "</td><td>"
										+ status + "</td><td>"
										+ order.orderBeginTime + "</td></tr>";
							}
							$("#orders tr:gt(0)").remove();
							$("#orders").append(str);
						}
					})
			//订单ajax结束
})
$(function(){
// 			输入联系人姓名
			var orderUname=0;
			$("#orderUserName").change(function(){
				if($(this).val()==null||$(this).val().length==0){
					$(this).parent().addClass("colorRed");
					orderUname=0;
				}else{
					$(this).parent().removeClass("colorRed");
					orderUname=1;
				}

			});
			// 			输入联系人电话
			var orderUphone=0;
			$("#orderUserPhone").change(function(){
				var phone=$(this).val();
				  if(!(/^1[3|4|5|8][0-9]\d{4,8}$/.test(phone))){ 
        				alert("不是完整的11位手机号或者正确的手机号前七位"); 
        				$(this).focus();
        				$(this).parent().addClass("colorRed");
       					 return false; 
   					 }else{
   					 $(this).parent().removeClass("colorRed");
   					 orderUphone=1;
   					 }

			
			});
			var subjectIsChoosed=0;
			var gradeIsChoosed=0;
			// 	点击预约，ajax
			$("#order_person_submit").click(function() {
				if(orderUname==0){
					$("#orderUserName").parent().addClass("colorRed");
					return false;
				}
				if(orderUphone==0){
					$("#orderUserPhone").parent().addClass("colorRed");
					return false;
				}
			
				var userType=$.cookie("type");
				if(userType==2){
					alert("老师不能预约老师！")
					$(this).parent().parent().parent().parent().fadeOut();
					location.href="/GDZjiajiaowang/source/page/index.jsp"
					return false;
				}
				if(userType==3){
					alert("您是管理员，就不要凑热闹啦！！")
					$(this).parent().parent().parent().parent().parent().fadeOut();
					location.href="/GDZjiajiaowang/source/page/admin.jsp"
					return false;
				}
				if(userType==1){
								var teacherId = "${teacherInfos.teacherId}";
								var subjects = new Array();
								var i = 0;
								$("#chose_subject_div").find(".choose_subject").each(function() {
													subjects[i] = $(this).attr("subjectId");
													i++;
												})
								if(i==0){
									$(this).prev().addClass("colorRed");
								}
								var userName = $(this).parent().find(
										"input[name='userName']").val();
								var userPhone = $(this).parent().find(
										"input[name='userPhone']").val();
								var gradeName = $(this).parent().find(
										"#gradeName_choose").val();
										
								var jsonSubmit = {
									"teacherId" : teacherId,
									"userName" : userName,
									"userPhone" : userPhone,
									"gradeId" : gradeName,
									"subjects" : subjects
								}
								$.ajax({
											type : "post",
											data : jsonSubmit,
											datatype : "json",
											url : "/GDZjiajiaowang/NewOrderByUserServlet",
											traditional:true,
											contentType : "application/x-www-form-urlencoded; charset =utf-8",
											success : function(order) {
												alert(order);
												if (order.orderId>0) {
														$("#newOrderByStudentId").text(order.orderId);
														$("#newOrderByStudentSubjects").text(order.subjectName);
														$("#newOrderByStudentStudetnName").text(order.studentName);
														$("#newOrderByStudentTeacherName").text(order.teacherRealName);
														$("#newOrderByStudentStudentPhone").text(order.studentPhone);
														$("#newOrderByStudentDate").text(order.orderBeginTime);
												
												
													$(".student_order_show").fadeIn();
												} else {
													alert("失败")
												}
											}
										})
							//ajax结束
							}else{
							$("#loginNow_div").show();
								
							
							}	
					})
			
		

			// 				设置可选科目
			var subjects_divspan = "${teacherInfos.subjectName}";
			$("#chose_subject_div span").each(function() {
				if (subjects_divspan.indexOf($(this).text()) >= 0) {
					$(this).show().addClass("canTeachSubject");
				} else {
					$(this).hide();
				}

			})

			// 				设置可选年级
			var grades_selectoptions = "${teacherInfos.gradeName}";
			$("#gradeName_choose option").each(function() {
				if (grades_selectoptions.indexOf($(this).text()) >= 0) {
					$(this).show().attr("selected","selected").siblings().removeAttr("selected");
				} else {
					$(this).hide().removeAttr("selected");
				}
				if (grades_selectoptions.indexOf("高中") >= 0) {
					$("#gradeName_choose option").each(function(){
							if (($(this).text()).indexOf("高") >= 0) {
									$(this).show();
							}
					})
				}
				if (grades_selectoptions.indexOf("初中") >= 0) {
					$("#gradeName_choose option").each(function(){
							if (($(this).text()).indexOf("初") >= 0) {
									$(this).show();
							}
					})
				}
			})
			change_gradeName(document.getElementById("gradeName_choose"));
	})	
function change_gradeName(select) {
		var $select = $(select);
		var $gradeName=$select.val();
		if ($gradeName<14) {
			$("#chose_subject_div .canTeachSubject").each(function() {
						if ($(this).text().indexOf("语文") >= 0|| $(this).text().indexOf("数学") >= 0|| $(this).text().indexOf("英语") >= 0) {
								$(this).show();
							} else {
								$(this).hide().addClass("hidejustNow");
							}
						})
			} else {
				$("#chose_subject_div .hidejustNow").show();
			}
		$("#chose_subject_div").find("span").removeClass("choose_subject");
}
</script>
</html>
